package com.lly.pro.common;

/**
 * 响应构建工具
 * @author Hommond
 * @date 2/22/2019
 */
public class ResponseJsonUtil {
    public static final ResponseJson SUCCESS_WITH_NO_DATA = new ResponseJson(ResponseStatusCodes.SUCCESS);
    public static final ResponseJson SYSTEM_ERROR = new ResponseJson(ResponseStatusCodes.SYSTEM_ERROR);

    public static <T> ResponseJson getSuccessResult(T result){
        ResponseJson rjson = new ResponseJson();
        rjson.setCode(ResponseStatusCodes.SUCCESS);
        rjson.setResult(result);
        return rjson;
    }

    public static ResponseJson getErrorResult(Integer errorCode,String msg){
        ResponseJson rjson = new ResponseJson();
        rjson.setCode(errorCode);
        rjson.setResult(msg);
        return rjson;
    }
}
